// import a from '../../node_modules/axios/dist/axios.js'
// import '../../node_modules/axios/dist/axios.js';
import axios from "axios";
import { getToken } from "../utils/storageUtils";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css'

// axios 二次封装

axios.interceptors.request.use(config=>{
    // config.baseURL = 'http://localhost:8082';
    config.baseURL = '/api';
    config.headers.token = getToken();

    // 显示进度条
    NProgress.start()

    return config;
})

axios.interceptors.response.use(res=>{

    // 隐藏进度条
    NProgress.done()

    return res.data;
},rea=>{
    // 介绍获取失败时处理的函数
})

export default axios;